<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

function getcmmbpaysignature($post_data,$key){

    ksort($post_data);

    $o="";
    foreach ($post_data as $k=>$v)
    {
        $o.= "$k=".($v)."&";
    }
    $post_data=substr($o,0,-1);
    $post_data_temp=$post_data.$key;
    $signIn=strtoupper(md5($post_data_temp));
    return $signIn;

}

//卡券抵扣详情
function getdeduzkinfo($arr,$card_zk){
    $arr = json_decode($arr, JSON_UNESCAPED_UNICODE);
    $CardGeneral = new \app\common\model\CardGeneral();
    if (is_array($arr)) {
        foreach ($arr as $k => $v) {
            if (isset($v['card_id'])) {
                $datas[$k] = $CardGeneral->where(['card_id' => $v['card_id']])->value('title').'、';
            } else {
                $datas = [''];
            }
        }
    }else{
        $datas = [''];
    }
    if ($datas) {
        $data = '卡券:'.implode(',', $datas).'('.$card_zk.'元)';
    } else {
        $data = '';
    }
    return $data;
}
//会员卡折扣详情
function getdiszkinfo($dis_zk){
    if ($dis_zk && $dis_zk > 0){
        $data = '/会员卡折扣共:['.$dis_zk.']元';
    }else{
        $data = '';
    }
    return $data;
}
//会员等级折扣详情
function getvipzkinfo($vip_zk){
    if ($vip_zk && $vip_zk > 0){
        $data = '会员等级折扣共:['.$vip_zk.']元';
    }else{
        $data = '';
    }
    return $data;
}